﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Example06_CSharp
{
    class Polygon
    {
        protected int width, height;
        public
               void setvalues(int a, int b)
        {
            width = a;
            height = b;
        }
        class Rectangle : Polygon
        {
            public int area()
            {
                return (width * height);
            }

            class Triangle : Polygon
            {
                public int area()
                {
                    return (width * height / 2);
                }

            }

            class Program
            {
                static void Main(string[] args)
                {
                    Rectangle rect = new Rectangle();
                    Triangle trgl = new Triangle();
                    rect.setvalues(4, 5);
                    trgl.setvalues(4, 5);
                    Console.WriteLine("rect :{0}", rect.area());
                    Console.WriteLine("trgl :{0}", trgl.area());

                }
            }
        }
    }
}